package cn.webrx;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class List8 {
    public static void main(String[] args) {
        //User u1 = new User(1,"李四",30);
        //User u2 = new User(1,"李四",20);
        //System.out.println(u1 == u2);
        //System.out.println(u1.equals(u2));

        List<User> list = new ArrayList<>(List.of(
                new User(1, "李四", 60),
                new User(2, "张四", 77),
                new User(3, "王四", 55),
                new User(4, "周四", 10),
                new User(5, "赵四", 20),
                new User(6, "郑四", 90)
        ));
        System.out.println(list);
        //Collections.shuffle(list);
        //System.out.println(list);

        //根据用户的成绩降序
        Collections.sort(list,(a,b)->b.getScore()-a.getScore());
        System.out.println(list);
    }
}
